#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define MAXSIZE 100000
typedef int ElementType;
typedef int Position;
typedef struct LNode *List;
struct LNode {
    ElementType Data[MAXSIZE];
    Position Last; 
};
int main(){
	List L;
	L=(struct LNode *)malloc(sizeof(struct LNode));
	L->Last=0;
	int n,i=0,j=0,k=0,a[MAXSIZE],max=1,count;
	scanf("%d",&n);
	for(i=0;i<n;i++){
	scanf("%d",&L->Data[i]);
	L->Last++;}
    for(i=0;i<L->Last;i++){
    	j=i;
    	a[i]=1;
    while(j<L->Last-1){
    		if(L->Data[j+1]<=L->Data[j])break;
    	else{
    		a[i]++;
    		j++;
    	}	
		if(a[i]>max){
			max=a[i];
			count=i;
		} 
	}
}
  	for(j=count;j<count+max;j++){
         		if(j==count+max-1)
         		printf("%d",L->Data[j]);
         		else printf("%d ",L->Data[j]);
         	}
	return 0;
} 
